﻿<UserControl x:Class="CrazyWorship1.ClientManagerControl"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:c="clr-namespace:CrazyWorship1"
             xmlns:data="clr-namespace:System.Data;assembly=System.Data"
 >
    <!--             xmlns:diagnostics="clr-namespace:System.Diagnostics;assembly=WindowsBase" 
   -->
    <Grid>
        <Grid.Resources>
            <c:IntToBoolean x:Key="IntToBool"/>

            <c:ClientManager x:Name="clientm" x:Key="cm"></c:ClientManager>
        </Grid.Resources>
        <Button Height="23" Margin="13,0,0,10" Name="Add" VerticalAlignment="Bottom" Click="Add_Click" HorizontalAlignment="Left" Width="75">Add Client</Button>
        <Button Margin="94,0,0,12" Name="Delete" Height="22" VerticalAlignment="Bottom" Click="Delete_Click" HorizontalAlignment="Left" Width="97">Delete Client</Button>
        <TextBox Height="23" Margin="13,0,0,39" Name="textBox1" VerticalAlignment="Bottom" HorizontalAlignment="Left" Width="178" />
        <ListBox Margin="13,38,0,68" Name="clientListBox"  ItemsSource="{Binding Path=ClientManager.ClientList}"  HorizontalAlignment="Left" Width="178" SelectionChanged="clientListBox_SelectionChanged">
            <ListBox.Resources>
                <c:BooleanToHiddenVisibility x:Key="boolToVis"/>
                <c:BooleanToHiddenVisibility2 x:Key="boolToVis2"/>

            </ListBox.Resources>
            <ListBox.ItemTemplate>
                <DataTemplate >
                    <StackPanel>
                        <TextBlock Foreground="Red" Visibility="{Binding Path=Connected, Converter={StaticResource boolToVis2}}" Text="{Binding Path=ClientUrl}"></TextBlock>
                        <TextBlock Foreground="Green" Visibility="{Binding Path=Connected, Converter={StaticResource boolToVis}}" Text="{Binding Path=ClientUrl}"></TextBlock>

                    </StackPanel>
                </DataTemplate>
            </ListBox.ItemTemplate>

        </ListBox>
        <ListBox Margin="197,38,12,0" Name="screenListBox" Height="74" ItemsSource="{Binding ElementName=clientListBox,Path=SelectedItem.ScreenInfoList}" VerticalAlignment="Top" SelectionChanged="screenListBox_SelectionChanged">

            <ListBox.ItemTemplate>
                <DataTemplate >
                    <TextBlock Foreground="Red" Text="{Binding Path=DeviceName}">-<TextBlock Foreground="Red" Text="{Binding Path=Bounds}"/></TextBlock>
                </DataTemplate>
            </ListBox.ItemTemplate>
        </ListBox>
        <Label Height="28" HorizontalAlignment="Left" Margin="12,4,0,0" Name="label1" VerticalAlignment="Top" Width="120">Clients:</Label>
        <Label Height="28" Margin="197,4,135,0" Name="label2" VerticalAlignment="Top">Screens:</Label>
        <CheckBox Margin="197,118,135,0" Name="screenEnabled" Height="16" VerticalAlignment="Top" IsChecked="{Binding Path=CheckScreen}" Checked="screenEnabled_Checked">Enabled</CheckBox>
        <CheckBox Margin="197,140,135,144" Name="screenFullScreen" IsChecked="{Binding Path=SelectedScreen.IsFullScreen}">FullScreen</CheckBox>
        <TextBox Height="23" Margin="258,0,0,115" Name="screenPosX" VerticalAlignment="Bottom" Text="{Binding Path=SelectedScreen.Bounds.Left}" HorizontalAlignment="Left" Width="59" />
        <TextBox Height="23" HorizontalAlignment="Right" Margin="0,0,66,115" Name="screenPosY" Text="{Binding Path=SelectedScreen.Bounds.Top}" VerticalAlignment="Bottom" Width="63" />
        <Label Height="28" Margin="197,0,192,110" Name="label3" VerticalAlignment="Bottom">Position:</Label>
        <Label Height="28" Margin="197,0,135,81" Name="label4" VerticalAlignment="Bottom">Size:</Label>
        <TextBox Height="23" HorizontalAlignment="Left" Margin="258,0,0,81" Text="{Binding Path=SelectedScreen.Bounds.Width}" Name="screenSizeX" VerticalAlignment="Bottom" Width="59" />
        <TextBox Height="23" HorizontalAlignment="Right" Margin="0,0,66,81" Text="{Binding Path=SelectedScreen.Bounds.Height}" Name="screenSizeY" VerticalAlignment="Bottom" Width="63" />
    </Grid>
</UserControl>
